	package ru.tpu.AAD.MalakhovaZaripov.Entities;

	import java.util.List;

import javax.persistence.*;

	@Entity
	@Table(name = "category")
	public class Category {

		@Column(name= "category_name", length=255)
		private String categoryName;

		
		@ManyToOne(fetch=FetchType.LAZY)
		@JoinColumn(name= "category_parent_category")
		private Category parentCategory;
		
		@OneToMany(mappedBy="parentCategory", fetch=FetchType.LAZY)
		private List<Category> childCategories;
		
		@OneToMany(mappedBy="category", fetch=FetchType.LAZY)
		private List<Device> devices;

		public List<Device> getDevices() {
			return devices;
		}

		public void setDevices(List<Device> devices) {
			this.devices = devices;
		}

		@Id
	    @Column(name= "category_id")
	    @GeneratedValue(strategy = GenerationType.AUTO)
		private Integer categoryId;

		public String getCategoryName() {
			return categoryName;
		}

		public void setCategoryName(String categoryName) {
			this.categoryName = categoryName;
		}

		public Category getParentCategory() {
			return parentCategory;
		}

		public void setParentCategory(Category category2) {
			this.parentCategory = category2;
		}

		public Integer getCategoryId() {
			return categoryId;
		}

		public void setCategoryId(Integer categoryId) {
			this.categoryId = categoryId;
		}

		public void setChildCategories(List<Category> childCategories) {
			this.childCategories = childCategories;
		}

		public List<Category> getChildCategories() {
			return childCategories;
		}

	}
